package com.example.intermingle.service;

import com.example.intermingle.dto.JqGridPageDto;
import com.example.intermingle.mapper.PollingMapper;
import com.example.intermingle.vo.Polling;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 绿松石
 * @version V1.0
 * @Title pollingService
 * @Description
 * @date 2021年09月29日 10:00
 * @since V1.0
 */
@Service
public class pollingService {

    @Autowired
    PollingMapper pollingMapper;

    public JqGridPageDto<Polling> selectAllPolling(){
        JqGridPageDto<Polling> pollingJqGridPageDto=new JqGridPageDto<>();
        List<Polling> pollingList=pollingMapper.selectAll();
        long count=pollingMapper.getTotal();
        if(pollingList!=null){
            pollingJqGridPageDto.setRows(pollingList);
            pollingJqGridPageDto.setRecords(count);
        }else{
            pollingJqGridPageDto.setErrorMsg("查不到轮询信息");
        }

      return  pollingJqGridPageDto;
    }
}
